package com.wry.spring.extension;

import org.springframework.beans.factory.DisposableBean;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.stereotype.Service;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;

/**
 * <h1>  </h1>
 *
 * @author wry
 * @since 2025.04.06
 */
@Service
public class AService implements InitializingBean, DisposableBean {

    // 两种方法，一种实现接口，一种注解

    @PostConstruct
    public void init(){
        System.out.println("AService初始化时 -> 扩展点");
    }

    @Override
    public void afterPropertiesSet() throws Exception {
        System.out.println("AService初始化时 -> 扩展点");
    }

    // bean销毁方法
    @PreDestroy
    public void destroy() throws Exception {
        System.out.println("AService销毁 -> 扩展点");
    }
}
